<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">{{title}}</view>
		</cu-custom>
		<view class="cu-bar bg-white">
			<view class="action sub-title">
				<text class="text-xl text-bold text-green">{{title}}</text>
				<text class="bg-green" style="width:4rem"></text>
			</view>
		</view>
		<view class="cu-card article" v-for="(item, index) in activityList" :key="item.id">
			<view class="cu-item shadow" style="border: 2upx solid lightgray;" @click="activityClick(item.id)">
				<view class="title justify-between flex">
					<view class="text-cut">{{item.title}}</view>
					<view class="text-gray text-sm">
						<text class="cuIcon-attentionfill margin-lr-xs text-green"></text>{{item.view}}
						<text class="cuIcon-messagefill margin-lr-xs text-green"></text>{{item.comment}}
						<text class="cuIcon-hotfill margin-lr-xs text-green"></text>{{item.hot}}
					</view>
				</view>
				<view class="content">
					<image :src="url + '/image/' + item.photo" mode="aspectFill">
					</image>
					<view class="desc">
						<view class="text-content">{{item.content}}</view>
						<view>
							<view class="cu-tag bg-red light sm round" style="font-family: 'TsangerYuYangT W03';">
								{{item.time}}
							</view>
							<view class="cu-tag bg-green light sm round" style="font-family: 'TsangerYuYangT W03';">
								{{item.place}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-bar bg-white justify-center">
			<view class="action">
				<text class="cuIcon-pullup text-green"></text>
				<text>没有更多了哦</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.url,
				title: '文体活动',
				activityList: [],
			}
		},
		methods: {
			activityClick(id) {
				uni.navigateTo({
					url: '/pages/activityDetail/activityDetail?id=' + id
				})
			},
		},
		onLoad(option) {
			if (option.id == 1)
				this.title = '文体活动'
			else if (option.id == 2)
				this.title = '学术竞赛'
			else if (option.id == 3)
				this.title = '大咖讲座'
			else this.title = '其它'
			uni.request({
				method: 'GET',
				url: this.url + '/home',
				data: {
					category: this.title
				},
				success: (res) => {
					console.log(res)
					if (res.statusCode == 200) {
						this.activityList = res.data.records
					}
				}
			})
		},
	}
</script>

<style>

</style>
